<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<title>validation</title>

		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="this is my page">
		<meta http-equiv="content-type" content="text/html; charset=UTF-8">
		<script type="text/javascript" src="prototype-1.6.0.3.js"></script>
		<script type="text/javascript" src="Validator.js"></script>
		<style type="text/css">
td {
	font-size: 12px;
	text-align: left;
	border-bottom: #cccccc 1px solid;
}

.message {
	color: #cccccc;
	font-size: 12px;
}
.error{
	color: #cccccc;
	font-size: 12px;
}
</style>
		<script type="text/javascript">
		var demo;
function init(){
	demo = new EmapValidator("demo");
	demo.add(new RequiredValidation("requiredValidation","必须验证","此项不可为空!!"));
	demo.add(new EmailValidation("EmailValidation","EMail","请输入正确的E-Mail地址!!")); 
	demo.add(new NumericalValidation("NumericalValidation","数值","请输入正确的数值!!"));
	/*var o = new NumericalValidation("NumericalValidation","数值","请输入正确的数值!!");
		o.matching = function (value){
			return /^\d+$/.test(value);
		}
	demo.add(o);*/
	demo.add(new AlphaValidation("AlphaValidation","英文字母","请仅仅输入英文字符!!"));
	demo.add(new DateValidation("DateValidation","日期","请输入正确的日期!!"));
	demo.add(new ChineseValidation("ChineseValidation","汉字","请仅仅输入汉字!!"));
	demo.add(new URLValidation("URLValidation","网址","请输入正确的网址!!"));
	demo.add(new AlphaNumericValidation("AlphaNumericValidation","英文/数字","请仅仅输入英文/数字!!"));
	demo.add(new PhoneNumberValidation("PhoneValidation","电话号码","请输入正确的电话号码!!"));
	demo.add(new RequiredValidation("requiredValidationpass","必须验证","此项不可为空!!"));
	demo.add(new CompareValidation("CompareValidation","比较验证","两次输入不相同!!","requiredValidationpass"));
	demo.prepare = function(){
		$('requiredValidation').value = '123456';
	}
	//demo.apply();
}
</script>
	</head>

	<body onload="init();">
		<div style="width: 400;">
			<form method="post" id="demo" action="">
				<fieldset>
					<table width="400" align="center">
						<tbody>
							<tr>
								<td>
									非空验证
								</td>
								<td>
									&nbsp;
								</td>
								<td>
									&nbsp;
									<input type="text" id="requiredValidation"
										name="requiredValidation" />
								</td>
							</tr>
							<tr>
								<td>
									EMail:
								</td>
								<td>
									&nbsp;
								</td>
								<td>
									&nbsp;
									<input type="text" id="EmailValidation" name="EmailValidation" />
								</td>
							</tr>
							<tr>
								<td>
									数值验证:
								</td>
								<td>
									&nbsp;
								</td>
								<td>
									&nbsp;
									<input type="text" id="NumericalValidation"
										name="NumericalValidation" />
								</td>
							</tr>
							<tr>
								<td>
									英文字母验证:
								</td>
								<td>
									&nbsp;
								</td>
								<td>
									&nbsp;
									<input type="text" id="AlphaValidation" name="AlphaValidation">
								</td>
							</tr>
							<tr>
								<td>
									日期验证;
								</td>
								<td>
									&nbsp;
								</td>
								<td>
									&nbsp;
									<input type="text" id="DateValidation" name="DateValidation" />
								</td>
							</tr>
							<tr>
								<td>
									汉字验证:
								</td>
								<td>
									&nbsp;
								</td>
								<td>
									&nbsp;
									<input type="text" id="ChineseValidation"
										name="ChineseValidation" />
								</td>
							</tr>
							<tr>
								<td>
									网址验证;
								</td>
								<td>
									&nbsp;
								</td>
								<td>
									&nbsp;
									<input type="text" id="URLValidation" name="URLValidation" />
								</td>
							</tr>
							<tr>
								<td>
									英文/数字;
								</td>
								<td>
									&nbsp;
								</td>
								<td>
									&nbsp;
									<input type="text" id="AlphaNumericValidation"
										name="AlphaNumericValidation" />
								</td>
							</tr>
							<tr>
								<td>
									电话号码:
								</td>
								<td>
									&nbsp;
								</td>
								<td>
									&nbsp;
									<input type="text" id="PhoneValidation" name="PhoneValidation" />
								</td>
							</tr>
							<tr>
								<td>
									密码:
								</td>
								<td>
									&nbsp;
								</td>
								<td>
									&nbsp;
									<input type="password" id="requiredValidationpass"
										name="requiredValidationpass" />
								</td>
							</tr>
							<tr>
								<td>
									比较验证:
								</td>
								<td>
									&nbsp;
								</td>
								<td>
									&nbsp;
									<input type="password" id="CompareValidation"
										name="CompareValidation" />
								</td>
							</tr>

							<tr>
								<td colspan="3" align="center">
									<input type="submit" value="提交" />
									<input type="reset" value="重置"/>
								</td>
							</tr>
						</tbody>
					</table>
				</fieldset>
			</form>
		</div>
	</body>
</html>
